<template>
  <p-layout class="home">
    <home-header />

    <div class="home-content-wrap">
      <p-sider-menu :search="false" />

      <p-layout-content class="home-content">
        <!-- <BreadcrumbNav /> -->
        <p-router-tabs scroll />
      </p-layout-content>
    </div>
  </p-layout>
</template>

<script>
import HomeHeader from './components/home-header';
// import BreadcrumbNav from './BreadcrumbNav.vue';

export default {
  name: 'Home',
  components: {
    HomeHeader,
    // BreadcrumbNav,
  },
  created() {
    this.handleIframeNotify();

    // 系统列表
    this.$store.dispatch('requestSysUid');
  },
  methods: {
    // 接收 iframe 的消息
    handleIframeNotify() {
      window.addEventListener('message', (event) => {
        try {
          if (event.data.type === 'updateUserInfo') {
            this.$store.dispatch('requireUserInfo');
          }
        } catch (err) {
          console.log('message listener error:', err);
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
// /deep/ .poros-router-tabs-component {
//   display: none;
// }
.home {
  width: 100vw;
  min-width: 1280px;

  &-content-wrap {
    flex: 1;
    height: 0; // 防止溢出
    display: flex;

    .home-content {
      min-width: 0;
    }
  }
}
</style>
